﻿<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>

<xsl:template match="/">
	<xsl:variable name="Annonces" select="/GlobalVPLink2013/ListeAnnonces/Annonce"/>
	<xsl:variable name="GroupeN1" select="$Annonces[@Groupe='N1']"/>
	<xsl:variable name="GroupeN2" select="$Annonces[@Groupe='N2']"/>
	<xsl:variable name="GroupeN3" select="$Annonces[@Groupe='N3']"/>
	<xsl:variable name="GroupeN4" select="$Annonces[@Groupe='N4']"/>
	<xsl:variable name="GroupeN5" select="$Annonces[@Groupe='N5']"/>
	<input type="hidden" name="MyAction" value=""/>
	<input type="hidden" name="likedAnnonceID" value=""/>
	<script language="javascript">
			function JAime(annonceID)
			{
				var frm = document.forms[0];
				frm.MyAction.value = "jaime";
				frm.likedAnnonceID.value = annonceID;
				frm.submit();
			}
	</script>	
	<xsl:if test="$GroupeN1">
				<div id="first-item" class="item_bloc1">
					<header>
						<h2>
							<xsl:choose>
								<xsl:when test="$GroupeN1/@Categorie = 'Quizz'">
									<div class="quizHeader"><span>A la une : </span> <xsl:value-of select="$GroupeN1/@Titre"/></div>
								</xsl:when>
								<xsl:otherwise>
									<a href="{$GroupeN1/@LinkDetail}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{$GroupeN1/@TitrePiwik}']);"><span>A la une : </span> <xsl:value-of select="$GroupeN1/@Titre"/></a>
								</xsl:otherwise>
							</xsl:choose>
						</h2>
					</header>
					<xsl:if test="$GroupeN1/@Video">
						<script language="javascript">
							/************** Player Video ************/
							var vp4 = {
								VIDEO: '<xsl:value-of select="$GroupeN1/@Video"/>',
								OSTER: "/_layouts/15/VPLink2013/Images/jplayer.vp.skin.png"
							}
						</script>
						<script type="text/javascript" src="/_layouts/15/VPLink2013/js/bootstrap.js"></script>
						<div id="first-item_media" style="float: left;">
							<div id="jp_container_hme" class="jp-video" style="">
								<div class="jp-type-single">
									<div id="jquery_jplayer_hme" class="jp-jplayer"></div>
									<div class="jp-gui">
										<div class="jp-video-play">
											<a href="javascript:;" class="jp-video-play-icon" tabindex="1">play</a>
										</div>
										<div class="jp-interface">
											<div class="jp-progress">
												<div class="jp-seek-bar">
													<div class="jp-play-bar"></div>
												</div>
											</div>
											<div class="jp-current-time"></div>
											<div class="jp-duration"></div>
											<div class="jp-controls-holder">
												<ul class="jp-controls">
													<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
													<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
													<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
													<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
													<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
													<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
												</ul>
												<div class="jp-volume-bar">
													<div class="jp-volume-bar-value"></div>
												</div>
												<ul class="jp-toggles">
													<li><a href="javascript:;" class="jp-full-screen" tabindex="1" title="full screen">full screen</a></li>
													<li><a href="javascript:;" class="jp-restore-screen" tabindex="1" title="restore screen">restore screen</a></li>
												</ul>
											</div>
										</div>
									</div>
									<div class="jp-no-solution">
										<span>Update Required</span>To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
									</div>
								</div>
							</div>                     
						</div>
					</xsl:if>
					<xsl:if test="$GroupeN1/@Photo1 and not($GroupeN1/@Video)">
						<div style="float: left;">
							<xsl:choose>
								<xsl:when test="$GroupeN1/@Categorie = 'Quizz'">
									<img src="{$GroupeN1/@Photo1}" alt="" title=""/>								
								</xsl:when>
								<xsl:otherwise>
									<a href="{$GroupeN1/@LinkDetail}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{$GroupeN1/@TitrePiwik}']);">
										<img src="{$GroupeN1/@Photo1}" alt="" title=""/>
									</a>
								</xsl:otherwise>
							</xsl:choose>
						</div>
					</xsl:if>
					<div class="item_description heightDescriptionNews">
						<xsl:if test="not($GroupeN1/@Categorie = 'Quizz')">
							<p>
								<a href="{$GroupeN1/@LinkDetail}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{$GroupeN1/@TitrePiwik}']);">
									<xsl:if test="$GroupeN1/@DatePublication"><b><xsl:value-of select="$GroupeN1/@DatePublication"/></b> - </xsl:if>
									<span><xsl:value-of select="$GroupeN1/@ChapeauCourt"/></span>
								</a>
							</p>
						</xsl:if>
						<br/>
						
						<xsl:if test="$GroupeN1/@Video">
							<p id="link-all_medias"><a href="http://vplink/Videos/Forms/AllItems.aspx" onclick="javascript:_paq.push(['trackPageView', 'VIDEOS']);">Retrouvez l'ensemble des videos.</a></p>
						</xsl:if>
						<span class="item_title">
							<xsl:choose>
								<xsl:when test="$GroupeN1/@Categorie = 'Quizz'">
									<div>
										<input type="hidden" value="{$GroupeN1/@Titre}" class="quizzTitle" />
										<div class="quizzButtons">
											<input type="radio" name="quizz" value="vrai" /><span>Vrai</span>
											<input type="radio" name="quizz" value="faux" /><span>Faux</span>
										</div>
										<div class="quizzButtons">
											<div>
											<a onclick="javascript:alert('Avant d\'en savoir plus, r\351pondez au quiz');">
												<span>En savoir plus</span>
											</a>
											</div>
										</div>
										<div class="quizzAnswer">
											<span><xsl:value-of select="$GroupeN1/@Surtitre"/></span>
											<p>
												<a href="{$GroupeN1/@QuizzNews}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{$GroupeN1/@QuizzNews}']);">
													<span>En savoir plus</span>
												</a>
											</p>
										</div>
									</div>
								</xsl:when>
								<xsl:otherwise>
									<xsl:if test="/GlobalVPLink2013/ConfigurationVP/@Like = 'Article seul'">
										<span class="item-like"><img src="/_layouts/15/VPLink2013/images/picto_like.jpg" height="17" width="19"/><p><xsl:value-of select="$GroupeN1/@NbLike"/></p></span>
									</xsl:if>
									<xsl:if test="/GlobalVPLink2013/ConfigurationVP/@Like = 'Partout'">
										<div class="item_title">
											<span class="item-like">
												<img src="/_layouts/15/VPLink2013/images/picto_like.jpg" height="17" width="19"/>
												<p><xsl:value-of select="$GroupeN1/@NbLike"/></p>
												<xsl:if test="not($GroupeN1/@LikeUserCrt = 'OK')">
													<span class="item-like_text">
														<xsl:variable name="annonceID" select="$GroupeN1/@ID"></xsl:variable>
														<a href="javascript:JAime({$annonceID});">j'aime</a>
													</span>
												</xsl:if>
												<xsl:if test="$GroupeN1/@LikeProcessed = 'OK'">
													<span class="item-like_text" style="color:#4f4f4f">
														Like enregistr&#233;
													</span>
												</xsl:if>
											</span>
										</div>
									</xsl:if>
								</xsl:otherwise>
							</xsl:choose>
						</span>
					</div>
				</div>		
	</xsl:if>
	
	<xsl:if test="$GroupeN2 or $GroupeN3 or $GroupeN4">
		<div class="bg_middle-content"></div>
		<div id="list_item" class="item_bloc">
			<ul>
				<xsl:call-template name="TemplateGroupeN234">
					<xsl:with-param name="Groupe" select="$GroupeN2"/>
				</xsl:call-template>
				<xsl:call-template name="TemplateGroupeN234">
					<xsl:with-param name="Groupe" select="$GroupeN3"/>
				</xsl:call-template>
				<xsl:call-template name="TemplateGroupeN234">
					<xsl:with-param name="Groupe" select="$GroupeN4"/>
				</xsl:call-template>
			</ul>
		</div>
	</xsl:if>
	
	<xsl:if test="$GroupeN5">
		<div class="bg_middle-content"></div>
		<div id="last_item" class="item_bloc">
			<header>
				<h2><a href="http://vplink/Pages/Annonces2013.aspx" onclick="javascript:_paq.push(['trackPageView', 'NEWS']);">DERNIERS ARTICLES</a></h2>
			</header>
			<xsl:for-each select="$GroupeN5">
				<xsl:call-template name="TemplateGroupeN5">
					<xsl:with-param name="Groupe" select="$GroupeN5"/>
				</xsl:call-template>
			</xsl:for-each>
			<div id="all_news"><a href="http://vplink/Pages/Annonces2013.aspx" onclick="javascript:_paq.push(['trackPageView', 'NEWS']);">Plus d'actualit&#233;s</a></div>                    
		</div>
	</xsl:if>
	
</xsl:template>
<xsl:template name="TemplateGroupeN5">
	<xsl:param name="Groupe" />
		<div class="inner-last">
			<div>
				<a href="{@LinkDetail}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{@TitrePiwik}']);"><img src="{@Photo3}" alt="" title=""/></a>
			</div>
			<div style="float:left;">
				<div class="last_description">
					<a class="last_title" href="{@LinkDetail}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{@TitrePiwik}']);">
						<b>
							<span><xsl:value-of select="@DatePublication"/> - </span>
							<xsl:value-of select="@Titre"/>
						</b>
						<span>&#160;</span>
						<p style="font-weight:normal">
							<xsl:value-of select="@Chapeau"/>
						</p>
					</a>
				</div>	
				<xsl:if test="/GlobalVPLink2013/ConfigurationVP/@Like = 'Partout'">
					<div class="item_title">
						<span class="item-like">
							<img src="/_layouts/15/VPLink2013/images/picto_like.jpg" height="17" width="19"/>
							<p><xsl:value-of select="@NbLike"/></p>
							<xsl:if test="not(@LikeUserCrt = 'OK')">
								<span class="item-like_text">
									<xsl:variable name="annonceID" select="@ID"></xsl:variable>
									<a href="javascript:JAime({$annonceID});">j'aime</a>
								</span>
							</xsl:if>
							<xsl:if test="@LikeProcessed = 'OK'">
								<span class="item-like_text" style="color:#4f4f4f">
									Like enregistr&#233;
								</span>
							</xsl:if>
						</span>
					</div>
				</xsl:if>
			</div>			
		</div>
</xsl:template>

<xsl:template name="TemplateGroupeN234">
	<xsl:param name="Groupe" />
	<li>
		<div>
			<h2 style="min-height: 36px;"><a href="{$Groupe/@LinkDetail}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{$Groupe/@TitrePiwik}']);"><xsl:value-of select="$Groupe/@TitreCourt"/></a></h2>
			<figure>
				<xsl:if test="$Groupe/@Photo2">
					<a href="{$Groupe/@LinkDetail}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{$Groupe/@TitrePiwik}']);"><img src="{$Groupe/@Photo2}" alt="" title=""/></a>
				</xsl:if>
				<figcaption class="item-figcaption">
						<xsl:if test="/GlobalVPLink2013/ConfigurationVP/@Like = 'Article seul'">
							<div class="item_title">
								<span class="item-like">
									<img src="/_layouts/15/VPLink2013/images/picto_like.jpg" height="17" width="19"/>
									<p><xsl:value-of select="$Groupe/@NbLike"/></p>
								</span>
							</div>
						</xsl:if>
						<xsl:if test="/GlobalVPLink2013/ConfigurationVP/@Like = 'Partout'">
						<div class="item_title">
							<span class="item-like">
								<img src="/_layouts/15/VPLink2013/images/picto_like.jpg" height="17" width="19"/>
								<p><xsl:value-of select="$Groupe/@NbLike"/></p>
								<xsl:if test="not($Groupe/@LikeUserCrt = 'OK')">
									<span class="item-like_text">
										<xsl:variable name="annonceID" select="$Groupe/@ID"></xsl:variable>
										<a href="javascript:JAime({$annonceID});">j'aime</a>
									</span>
								</xsl:if>
								<xsl:if test="$Groupe/@LikeProcessed = 'OK'">
									<span class="item-like_text" style="color:#4f4f4f">
										Like enregistr&#233;
									</span>
								</xsl:if>
							</span>
						</div>
					</xsl:if>
					<div class="item_description heightDescriptionNews">
						<p>
							<a href="{$Groupe/@LinkDetail}" onclick="javascript:_paq.push(['trackPageView', 'NEWS/{$Groupe/@TitrePiwik}']);">
								<xsl:if test="$Groupe/@DatePublication">
									<b><xsl:value-of select="$Groupe/@DatePublication"/></b> - 
								</xsl:if>
								<span>
									<xsl:value-of select="$Groupe/@ChapeauCourt"/>
								</span>
							</a>
						</p>
					</div>
				</figcaption>
			</figure>
		</div>
	</li>
 
</xsl:template>


</xsl:stylesheet>